//
// Created by JYL on 2024-06-23.
//

#ifndef LF_FOC_OLED_H
#define LF_FOC_OLED_H

#include "main.h"

#define CharSize_6x8    6
#define CharSize_8x16   8

#define NORMAL	  0		//?
#define REVERSE	  1		//

#define OLED_CMD  1
#define OLED_DATA 0

#define OLED_W_SCL(x)   do{ x ? \
                      HAL_GPIO_WritePin(OLED_SCL_GPIO_Port, OLED_SCL_Pin, GPIO_PIN_SET) : \
                      HAL_GPIO_WritePin(OLED_SCL_GPIO_Port, OLED_SCL_Pin, GPIO_PIN_RESET); \
                  }while(0)       /* LED0 = RED */
#define OLED_W_SDA(x)   do{ x ? \
                      HAL_GPIO_WritePin(OLED_SDA_GPIO_Port, OLED_SDA_Pin, GPIO_PIN_SET) : \
                      HAL_GPIO_WritePin(OLED_SDA_GPIO_Port, OLED_SDA_Pin, GPIO_PIN_RESET); \
                  }while(0)       /* LED0 = RED */

void OLED_Init(void);
void OLED_Clear(unsigned dat);
void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t Char_Size,_Bool reverse);
void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size,_Bool reverse);
void OLED_ShowNum(uint8_t x,uint8_t y,int32_t Number, uint8_t Length,uint8_t Char_Size);

#endif //LF_FOC_OLED_H
